﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
using System.ServiceModel.Dispatcher;
using System.Text;
using CoreEx.Wcf.Common;
using LinFu.IoC.Configuration;

namespace CoreEx.Wcf.Server.Tests
{
    [Implements(typeof(IClientMessageInspector), ServiceName = "SampleClientMessageInspector")]
    public class SampleClientMessageInspector : IClientMessageInspector
    {
        public object BeforeSendRequest(ref Message request, IClientChannel channel)
        {
            return null;
        }

        public void AfterReceiveReply(ref Message reply, object correlationState)
        {
            Console.WriteLine("");  
          
            
        }
    }

    [Implements(typeof(IClientEndpointBehavior), ServiceName = "SampleClientEndpointBehavior")]
    public class SampleClientEndpointBehavior : IClientEndpointBehavior
    {
        public void Validate(ServiceEndpoint endpoint)
        {
            //throw new NotImplementedException();
        }

        public void AddBindingParameters(ServiceEndpoint endpoint, BindingParameterCollection bindingParameters)
        {
            //throw new NotImplementedException();
        }

        public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
        {
            //throw new NotImplementedException();
        }

        public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
        {
            clientRuntime.MessageInspectors.Add(new SampleClientMessageInspector());
        }
    }
}
